package IO.常见类使用;

import java.io.File;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2022-09-15 23:09
 **/
public class FileDemo {
    public static void main(String[] args) {
        listAllFiles(new File("F:\\学习笔记\\algorithm"));
    }


    public static void listAllFiles(File dir) {
        if (dir == null || !dir.exists()) {
            return;
        }
        if (dir.isFile()) {
            System.out.println(dir.getName());
            return;
        }
        for (File file : dir.listFiles()) {
            listAllFiles(file);
        }
    }
}
